package Robot;
import javaclient3.*;

/**
 * Extends PlayerClient. This is only a helper class that permits the use of an
 * index for robot identification (specially for the formation behaviors).
 *
 * TODO: Esta libreria en la nueva version debe ser abstracta. Se debe
 * generar una nueva clase llamada NXBot que se encargue de: realizar la
 * peticion de todas las interfaces. Metodos para definir a cuales interfaces
 * no se pretende conectar
 * @author Alejandro Pustowka
 */
public class Robot extends PlayerClient{
    
    private String name;
    private static int numRobots=0;
    private int index;
    private String ip;
    private int port;

    //TODO: EStos parametros SI se manejaran en la proxima libreria
    //pero estos parametros se deberan leer de la respectiva position2d.
    public static final float width = 0.2f;
    public static final float height = 0.2f;
    public static final float radius = 0.1f;


    /**
     * Creates an instance of PlayerClient.
     * @param ip IP Address of the Player server.
     * @param port Port Addres of the Player server
     * @param name Name of the robot. Useful for identification.
     * @param index Index of the robot. Useful for identification (Example: formations).
     * @see PlayerClient
     */
    public Robot(String name,String ip, int port, int index) {
        super(ip,port);
        this.ip = ip;
        this.port = port;
        this.name = name;
        this.index = index;
        numRobots++;

    }
    
    
    /**
     * Special constructor for virtual robots. Used in formations.
     * @param name Name of the robot. Useful for identification.
     * @param index Index of the robot. Useful for identification (Example: formations).
     */
    public Robot(String name,int index){
        super("localhost",6665);
        this.index = index;
        this.name = name;
        port = this.getPortNumber();
        ip = "localhost";

    }

    /**
     * Gets the IP address where the Player server is executing.
     * @return IP Address of the Player server.
     */
    public String getIp() {
        return ip;
    }


    /**
     * Gets the index of this robot.
     * TODO: esta funcion podria ser eliminada en una proxima version.
     * el indice se pondria automaticamente a partir de numRobots.
     * @return Index of the robot.
     */
    public int getIndex() {
        return index;
    }

    /**
     * Sets the index of this robot.
     * @param index The new index of the robot.
     */
    public void setIndex(int index) {
        this.index = index;
    }



}
